home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / YICN23.ZIP / SOURCE / TESTPRG.CPP < prev    next >
C/C++ Source or Header  |  1993-03-06  |  4KB  |  118 lines

  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <conio.h>
  4. #include <alloc.h>
  5. #include "xlib.h"
  6. #include "xrletool.h"
  7. #include "icon.h"
  8. #include "animicon.h"
  9. #include "yakFont.h"
  10. #include "yakStick.h"
  11. #include "yakMouse.h"
  12. #include "yakWin.h"
  13. #include "yakPal.h"
  14. #include "boodle.h"
  15. #include "boodle2.h"
  16. #include "boodle3.h"
  17. #include "boodle4.h"
  18. #include "yakscrol.h"
  19. #include "yakpanel.h"
  20.  
  21. extern yakMouse mouse;
  22.  
  23. char * message = "testScroller: lo, indeed this is a test of the ill-begotten scroller class.";
  24.  
  25. void main(void)
  26. {
  27.   yakLib myYakLib("draw");
  28.   yakScroller myYakScroller(0, 0, 50, 50, (char *)myYakLib.loadToMem("icon.h"));
  29.   yakFont myYakFont("6x8b.fnt");
  30.   icon background, myIcon, myOtherIcon;
  31.   icon::setZoomTable(64);
  32.   animicon myanimicon;
  33.   animslave myslave;
  34.   unsigned int backpage_offs;
  35.   x_set_mode(2,360);
  36.   x_set_doublebuffer(200);
  37.   x_text_init();
  38.   mouse.init();
  39.   yakPalette myYakPalette("standard.ypl");
  40.   myYakPalette.put();
  41.   myYakFont.use();
  42.   myYakScroller.activate(30,30);
  43.   yakWindow * myYakWindows[5];
  44.   for (int counter = 0; counter < 5; ++counter)
  45.   {
  46.     myYakWindows[counter] = new yakScroller(10 + random(50), 10 + random(50), 110 + random(75), 60 + random(75), (char *)myYakLib.loadToMem("icon.h"));
  47.     myYakWindows[counter]->myNumber = counter;
  48.     strcpy(myYakWindows[counter]->title, "Test Scroller ");
  49.     itoa(counter, &myYakWindows[counter]->title[14], 10);
  50.     x_bgprintf(0,150,VisiblePageOffs, 15, 0, "Core Left: %ld", farcoreleft());
  51.     myYakWindows[counter]->open();
  52.   }
  53.   while(yakWindow::topWindow != NULL)
  54.     yakWindow::advance();
  55.   yakPanel myYakPanel(20,20,120,100);
  56.   pSwitch mypSwitch(50,12,'T', "togg");
  57.   pSwitch myHoppingGrumjug(30,30,'G', "lgrumjug", icon::normal, &myYakLib, gadget::touchPad);
  58.   slider mySlider(10,50, 70,10, 0,40);
  59.   myYakPanel.add(new gadgetNode(new button(2,13,'Q',1,"button", icon::normal, &myYakLib),
  60.                  new gadgetNode(new button(2,30,'M',2,"button", icon::normal, &myYakLib),
  61.                  new gadgetNode(new label(2, 58,'V',3,"Label!", 15, 0),
  62.                  new gadgetNode(&mypSwitch,
  63.                  new gadgetNode(&myHoppingGrumjug,
  64.                  new gadgetNode(&mySlider,NULL)))))));
  65. /*  myYakPanel.myButtonList.add(2,12, 'Q', 1, "button", icon::normal, &myYakLib);
  66.   myYakPanel.myButtonList.add(2,30, 'M', 2, "button", icon::normal, &myYakLib);
  67.   myYakPanel.myButtonList.add(new label(2,58, 'V', 3, "Label!", 15, 0));
  68.   myYakPanel.mypSwitchList.add(&mypSwitch);
  69.   myYakPanel.mypSwitchList.add(&myHoppingGrumjug);
  70.   myYakPanel.mySliderList.add(&mySlider);*/
  71.   myYakPanel.open();
  72.   while(yakWindow::topWindow != NULL)
  73.   {
  74.     word result = yakWindow::advance();
  75.     if (result)
  76.       x_bgprintf(0,175, VisiblePageOffs, 15, 0, "Button: %u", result);
  77.   }
  78.  
  79.   while(!joystick1.readButton1() && !kbhit())
  80.   {
  81.     myYakPalette.rotate(yakPalette::up);
  82.     myYakPalette.put();
  83.     x_bgprintf(0,0,VisiblePageOffs, 15, 0, "Joystick 1: x:%d  y:%d  button1:%d  button2: %d", joystick1.x, joystick1.y, joystick1.button1, joystick1.button2);
  84.   }
  85.   x_bgprintf(0,10,VisiblePageOffs, 15, 0, "Core Left: %ld", coreleft());
  86.   myIcon.load("star.yak", icon::normal, &myYakLib);
  87.   myOtherIcon.useData(boodleYak, icon::normal);
  88. //  myanimicon.addAll("boodle", icon::fast, &myYakLib);//, &myYakLib);
  89.   myanimicon.add(new animiconNode(boodleYak,
  90.                  new animiconNode(boodle2Yak,
  91.                  new animiconNode(boodle3Yak,
  92.                  new animiconNode(boodle4Yak, (animiconNode *)NULL)))));
  93.   int x, y, exit = 0;
  94.   backpage_offs = NonVisual_Offs;// + (Page1_Offs - Page0_Offs);
  95.     int scale=200;
  96.    x = 50;
  97.   while ((exit != 'Q') && (scale > 4))
  98.     {
  99. //    x = random(320); y = random(200);
  100. //    myOtherIcon.show(0,100,VisiblePageOffs);
  101. //    while(!kbhit());
  102. //    exit = getch();
  103. //    if (exit == '<') scale--;
  104. //    if (exit == '>') scale++;
  105.     scale-=2;
  106.     x += 1;
  107.     myIcon.showZoomed(x, 20, VisiblePageOffs, scale);
  108.     x_bgprintf(0,150,VisiblePageOffs, 15, 0, "Scale: %d   ", scale);
  109.     x_bgprintf(0,160,VisiblePageOffs, 15, 0, "Core Left: %ld   ", farcoreleft());
  110.     }
  111.   for (counter = 0; counter < 25; ++counter)
  112.   {
  113.     myYakPalette.fade(-5);
  114.     myYakPalette.put();
  115.   }
  116.   mouse.remove();
  117.   x_text_mode();
  118. }